package com.demo.service.impl;

import com.demo.entity.CartInfoList;
import com.demo.entity.Cartitem;
import com.demo.entity.Message;
import com.demo.mapper.CartitemMapper;
import com.demo.service.CartitemService;

import java.util.List;

public class CartitemServiceImpl implements CartitemService{
	//service������dao(mapper)
	private CartitemMapper cartitemMapper;
	public void setCartitemMapper(CartitemMapper cartitemMapper) {
		this.cartitemMapper = cartitemMapper;
	}

	@Override
	public List<CartInfoList> queryCartitemInfo(String uname) {
		return cartitemMapper.queryCartitemInfo(uname);
	}

	@Override
	public Cartitem selectCartInfoByProductId(String product_id) {
		return cartitemMapper.selectCartInfoByProductId(product_id);
	}
	@Override
	public void addCartInfoByProductId(String username,String product_id,int buynum) {
		cartitemMapper.addCartInfoByProductId(username,product_id,buynum);
	}
	@Override
	public void updateCartByProductId(String product_id,int addnum) {
		cartitemMapper.updateCartByProductId(product_id,addnum);
	}

	@Override
	public void deleteCartInfoByProductsName(String productsName) {
		cartitemMapper.deleteCartInfoByProductsName(productsName);
	}

	@Override
	public List<Message> queryMessageById(String pid) {
		return cartitemMapper.queryMessageById(pid);
	}

	@Override
	public void updateCartProductNum(int cnum, String productsName) {
		cartitemMapper.updateCartProductNum(cnum, productsName);
	}

	
}
